import { service } from "./Request";

const operationTypesApi = {
    // 获取所有操作类型
    getOperationTypes(params) {
        return service({
            url: "/operation-types",
            method: "get",
            params
        })
    },
    // 获取操作类型详情
    getOperationTypeDetail(id) {
        return service({
            url: `/operation-types/${id}`,
            method: "get"
        })
    },
    // 创建操作类型
    createOperationType(data) {
        return service({
            url: "/operation-types",
            method: "post",
            data
        })
    },
    // 更新操作类型
    updateOperationType(id, data) {
        return service({
            url: `/operation-types/${id}`,
            method: "put",
            data
        })
    },
    // 删除操作类型
    deleteOperationType(id) {
        return service({
            url: `/operation-types/${id}`,
            method: "delete"
        })
    },
    // 停用操作类型
    deactivateOperationType(id) {
        return service({
            url: `/operation-types/${id}/deactivate`,
            method: "put"
        })
    },
    // 启用操作类型
    activateOperationType(id) {
        return service({
            url: `/operation-types/${id}/activate`,
            method: "put"
        })
    }
};

export default operationTypesApi;